<template>
  <div>
    <div v-for="item in arr" :key="item.id" class="arrData">
      <img :src="item.scene_pic_url" alt="#" />
      <h3>{{ item.title }}</h3>
      <p>{{ item.subtitle }}</p>
      <p class="arrDatap">￥{{ item.price_info }}元起</p>
    </div>
    <van-pagination
      v-model="currentPage"
      mode="simple"
      :page-count="totalPages"
      @change="add"
      class="pag"
    />
  </div>
</template>

<script>
import { GetZtData } from "../../request/api";
export default {
  data() {
    return {
      arr: [],
      count: null,
      currentPage: null,
      pageSize: null,
      totalPages: null,
    };
  },
  created() {
    GetZtData(this.currentPage, this.pageSize).then((res) => {
      let { data, count, currentPage, pageSize, totalPages } = res.data;
      this.arr = data;
      console.log(data);
      this.count = count;
      this.currentPage = currentPage;
      this.pageSize = pageSize;
      this.totalPages = totalPages;
    });
  },
  methods: {
    add() {
      GetZtData(this.currentPage, this.pageSize).then((res) => {
        let { data, count, currentPage, pageSize, totalPages } = res.data;
        this.arr = data;
        this.count = count;
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.totalPages = totalPages;
      });
    },
  },
};
</script>
 
<style lang = "less" scoped>
.arrData {
  width: 100%;
  height: 100%;
  background-color: #fff;
  text-align: center;
  line-height: 30px;
  img {
    width: 100%;
    height: 100%;
  }
  .arrDatap {
    color: darkred;
  }
}
.pag {
  height: 90px;
}
</style>